package slowtask

import (
	"fmt"
	"cloud_worm/wormweb/controllers/ctrutil"
	"github.com/astaxie/beego/logs"
)

// 用于异步处理machine的信息更新
type UpdateMachineByCapital struct {
	IP 		string
	WormId 	string
}

// Done 执行
func (u *UpdateMachineByCapital) Doing()  {
	cap := ctrutil.CapitalDeal{
		IP: u.IP,
		WormId: u.WormId,
	}
	err := cap.TryAddMachineOrApplyOne()
	if err != nil {
		logs.Error(fmt.Sprintf("update apply and machine failed: %s", err.Error()))
	}
	return
}
